home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _20D65EB536BC4093989EE6D196368E91 < prev    next >
Encoding:
Text File  |  2004-01-06  |  7.0 KB  |  198 lines

  1.  
  2. --------------------------------------------------
  3. --    Created By: <Sten Huebler>
  4. --   Description: <Patrols Path>
  5. --------------------------
  6. --
  7.  
  8. AIBehaviour.IGTalking = {
  9.     Name = "IGTalking",
  10.     
  11.     
  12.     
  13.     XTime = 1,
  14.     XAttack = 1,
  15.     PathStep = 0,
  16.     Busy = 0,
  17.     
  18.     
  19.     Sounds = {
  20.         Ivan = Sound:Load3DSound("SOUNDS/E3DIALOG/i_there_open_fire.wav",SOUND_UNSCALABLE,255,5,15),
  21.         Ivan2 = Sound:Load3DSound("SOUNDS/E3DIALOG/i_i-see_him.wav",SOUND_UNSCALABLE,255,5,15),
  22.         Steve = Sound:Load3DSound("SOUNDS/e3ai/hey_over_there.wav",SOUND_UNSCALABLE,255,5,15),
  23.         Rob = Sound:Load3DSound("SOUNDS/E3DIALOG/r_i_see_him.wav",SOUND_UNSCALABLE,255,5,15),
  24.         Rob2 = Sound:Load3DSound("SOUNDS/E3DIALOG/r_target.wav",SOUND_UNSCALABLE,255,5,15),
  25.         Rob3 = Sound:Load3DSound("SOUNDS/E3DIALOG/r_move.wav",SOUND_UNSCALABLE,255,5,15),
  26.         Ray = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_there_he_is.wav",SOUND_UNSCALABLE,255,5,15),
  27.         Ray2 = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_over_there.wav",SOUND_UNSCALABLE,255,5,15),
  28.         Ray3 = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_open_fire.wav",SOUND_UNSCALABLE,255,5,15),
  29.         
  30.         talk01 = Sound:Load3DSound("SOUNDS/ai/dialog/m3a.wav",SOUND_UNSCALABLE,255,2,13),
  31.         talk02 = Sound:Load3DSound("SOUNDS/ai/dialog/m3b.wav",SOUND_UNSCALABLE,255,2,13),
  32.         talk03 = Sound:Load3DSound("SOUNDS/ai/dialog/m2a.wav",SOUND_UNSCALABLE,255,2,13),
  33.     },
  34.  
  35.     -- SYSTEM EVENTS            -----
  36.     ---------------------------------------------
  37.     OnSelected = function( self, entity )    
  38.     end,
  39.     ---------------------------------------------
  40.     OnSpawn = function( self, entity )
  41.         -- called when enemy spawned or reset
  42.         
  43.                     
  44.         -------------------------------- IDLE ---------------------------
  45.         
  46.                     
  47.         -- Make default Idle
  48.         AI:CreateGoalPipe("AIS_DefaultIdle");
  49.         AI:PushGoal("AIS_DefaultIdle","signal",0,1,"PlayDefaultIdleAnimation",0);
  50.         AI:PushGoal("AIS_DefaultIdle","timeout",1,3);
  51.         AI:PushGoal("AIS_DefaultIdle","AIS_PatrolPath");
  52.         
  53.         -- Make _talk01
  54.         AI:CreateGoalPipe("AIS_talk01");
  55.         AI:PushGoal("AIS_talk01","timeout",1,9.2);
  56.         AI:PushGoal("AIS_talk01","signal",0,1,"AIS_RandomIdle",0);
  57.         
  58.         -- Make _talk01
  59.         AI:CreateGoalPipe("AIS_talk02");
  60.         AI:PushGoal("AIS_talk02","timeout",1,3.1);
  61.         AI:PushGoal("AIS_talk02","signal",0,1,"AIS_RandomIdle",0);
  62.         
  63.         -- Make _talk01
  64.         AI:CreateGoalPipe("AIS_talk03");
  65.         AI:PushGoal("AIS_talk03","timeout",1,9.2);
  66.         AI:PushGoal("AIS_talk03","signal",0,1,"AIS_RandomIdle",0);
  67.         -------------------------------------------------------------------
  68.         
  69.  
  70.  
  71.         self:AIS_RandomIdle(entity,sender);
  72.     end,
  73.     ---------------------------------------------
  74.     OnActivate = function( self, entity )
  75.         -- called when enemy receives an activate event (from a trigger, for example)
  76.     end,
  77.     ---------------------------------------------
  78.     OnNoTarget = function( self, entity )
  79.         -- called when the enemy stops having an attention target
  80.         System:LogToConsole(entity:GetName().."I do not have a target");        
  81.     end,
  82.     ---------------------------------------------
  83.     OnPlayerSeen = function( self,entity )
  84.         System:LogToConsole(entity:GetName().." .. Seen");
  85.         entity:ChangeAIParameter( AIPARAM_SIGHTRANGE, 40);
  86.         self.XTime = random(1,9);
  87.         if (self.XTime == 1) then
  88.             entity:Say(entity.Behaviour.Sounds.Ivan);
  89.         elseif (self.XTime == 2) then
  90.             entity:Say(entity.Behaviour.Sounds.Ivan2);
  91.         elseif (self.XTime == 3) then
  92.             entity:Say(entity.Behaviour.Sounds.Steve);
  93.         elseif (self.XTime == 4) then
  94.             entity:Say(entity.Behaviour.Sounds.Rob);
  95.         elseif (self.XTime == 5) then
  96.             entity:Say(entity.Behaviour.Sounds.Rob2);
  97.         elseif (self.XTime == 6) then
  98.             entity:Say(entity.Behaviour.Sounds.Rob3);
  99.         elseif (self.XTime == 7) then
  100.             entity:Say(entity.Behaviour.Sounds.Ray);
  101.         elseif (self.XTime == 8) then
  102.             entity:Say(entity.Behaviour.Sounds.Ray2);
  103.         elseif (self.XTime == 9) then
  104.             entity:Say(entity.Behaviour.Sounds.Ray3);
  105.         end
  106.         entity:SelectPipe(0,"AIS_CoverDropBeacon");
  107.         AI:Signal(SIGNALFILTER_GROUPONLY, 1, "OnPlayerSeenByGroupMember", entity.id);
  108.     end,
  109.     ---------------------------------------------
  110.     OnEnemySeen = function( self, entity )
  111.         -- called when the enemy sees a foe which is not a living player
  112.     end,
  113.     ---------------------------------------------
  114.     OnEnemyMemory = function( self, entity )
  115.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  116.     end,
  117.     ---------------------------------------------
  118.     OnInterestingSoundHeard = function( self, entity )
  119.         -- called when the enemy hears an interesting sound
  120.     end,
  121.     ---------------------------------------------
  122.     OnThreateningSoundHeard = function( self, entity )
  123.         -- called when the enemy hears a scary sound
  124.         entity:ChangeAIParameter( AIPARAM_SIGHTRANGE, 40);
  125.     end,
  126.     ---------------------------------------------
  127.     OnReload = function( self, entity )
  128.         -- called when the enemy goes into automatic reload after its clip is empty
  129.     end,
  130.     ---------------------------------------------
  131.     OnGroupMemberDied = function(self, entity, sender)
  132.         System:LogToConsole(entity:GetName().." .. buddy died");
  133.         entity:SelectPipe(0,"AIS_TeamMemberDiedIndoor", sender.id);
  134.     end,
  135.     ---------------------------------------------
  136.     OnNoHidingPlace = function( self, entity, sender )
  137.         -- called when no hiding place can be found with the specified parameters
  138.         System:LogToConsole(entity:GetName().." .. no hidding place");
  139.         local XRandom = random(1,2);
  140.         if (XRandom == 1) then
  141.             entity:SelectPipe(0,"AIS_SideStepLeft");
  142.         elseif (XRandom == 2) then
  143.             entity:SelectPipe(0,"AIS_SideStepRight");
  144.         end
  145.     end,    
  146.     ---------------------------------------------
  147.     OnReceivingDamage = function ( self, entity, sender)
  148.         -- called when the enemy is damaged
  149.         --AI:Log(entity:GetName().." (DEFAULT) AIEVENT - OnReceivingDamage");
  150.         entity:ChangeAIParameter( AIPARAM_SIGHTRANGE,entity. );
  151.         entity:SelectPipe(0,"SearchDamageCause");
  152.     end,
  153.  
  154.  
  155. --------------------------- FUNCTIONS ------------------------------------
  156.  
  157.     
  158.     AIS_RandomIdle = function (self, entity, sender)
  159.         self.XTime = random(1,15);
  160.         if (self.XTime <= 5) then
  161.             entity:StartAnimation(0,"_talk01");
  162.             entity:Say(entity.Behaviour.Sounds.talk01);
  163.             entity:SelectPipe(0,"AIS_talk01");
  164.         elseif     (self.XTime <= 10) then
  165.             entity:StartAnimation(0,"_talk02");
  166.             entity:Say(entity.Behaviour.Sounds.talk02);
  167.             entity:SelectPipe(0,"AIS_talk02");
  168.         elseif     (self.XTime <= 15) then
  169.             entity:StartAnimation(0,"_talk03");
  170.             entity:Say(entity.Behaviour.Sounds.talk03);
  171.             entity:SelectPipe(0,"AIS_talk03");
  172.         end
  173.     end,
  174.  
  175.  
  176.     PlayDefaultIdleAnimation = function (self, entity, sender)
  177.         entity:StartAnimation(0,"sidle");
  178.     end,
  179.  
  180.  
  181.     AISF_CallForHelp = function (self, entity, sender)
  182.         System:LogToConsole(entity:GetName().." .. CallForHelp");
  183.     end,
  184.     
  185.     
  186.     AISF_GoOn = function (self, entity, sender)
  187.         --entity:SelectPipe(0,"AIS_GuardTraceAttack");
  188.     end,
  189.     
  190.     OnPlayerSeenByGroupMember = function ( self, entity, sender)
  191.         if  (entity ~= sender) then
  192.             entity:SelectPipe(0,"AIS_InvestigateSenderTarget", sender.id);
  193.         else
  194.         end
  195.     end,        
  196.  
  197. }
  198.